// import axios from 'axios';
 

const user = {
  state: {
    token: localStorage.getItem('userInfo') ? JSON.parse(localStorage.getItem('userInfo')).token : null
  },
  mutations: {
    SET_TOKEN: (state, token) => {      
      state.token = token;
      console.log(state.token)
    }
  },
  actions: {
    logOut({ commit }) {
      commit('SET_TOKEN', null)
    },
    saveUserInfo({ commit }, data) {
      commit('SET_TOKEN', data.token);
      return true;
    },
  }
};
export default user;
